package com.shop.mapper.ext;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.shop.dto.CommodityDto;
import com.shop.entity.CommodityDo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 商品表 Mapper 接口
 * </p>
 *
 * @author 靳 旺
 * @since 2020-12-17
 */
public interface CommodityDoMapperExt extends BaseMapper<CommodityDo> {
//    @Select("select * from commodity where id=#{id}")
//    User getUserById(@Param("id") Long id);

    @Select("select * from commodity")
    Page<CommodityDo> getUserList2();

    /**
     * 和Mybatis使用方法一致
     * @param name
     * @return
     */

//    @Select("select c.pk_commodity_id, c.commodity_name,c.commodity_no,c.price,c.size,ccr.pk_commodity_color_id,cc.name from commodity c\n" +
//            "            left join commodity_color_relation ccr on c.pk_commodity_id = ccr.fk_commodity_id\n" +
//            "            left join commodity_color cc on cc.pk_commodity_color_id = ccr.pk_commodity_color_id")
//    @ResultMap("com.shop.mapper.CommodityDoMapper.BaseResultMap")
    List<CommodityDto> getUserList();

    List<CommodityDto> search(String name);

}
